package com.wuyou.designPatterns.observer;

import java.util.Random;

/**
 * 随机数生成器
 *
 * @Date 2024/10/15 17:23
 * @Author 无忧
 */
public class RandomNumberGenerator extends NumberGenerator{

    private Random random = new Random();
    private int number;

    @Override
    public int getNumber() {
        return number;
    }

    @Override
    public void execute() {
        for(int i=0; i<20; i++){
            number = random.nextInt(50);
            notifyObservers();
        }
    }
}
